package com.bianmaba.oauth.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: spring-oauth2-demo
 * @description:
 * @author: Chenjiabin
 * @create: 2018/11/8 14:05
 **/
@RestController
@RequestMapping("order")
public class OrderController {
    @Autowired
    @Qualifier("orderOAuth2RestTemplate")
    private OAuth2RestTemplate restTemplate;

    @RequestMapping("query")
    public Object query() {
        return restTemplate.getForObject("http://192.168.0.13:6003/ors/order/query", String.class);
    }

    @RequestMapping("save")
    public Object save() {
        return restTemplate.getForObject("http://192.168.0.13:6003/ors/order/save", String.class);
    }

    @RequestMapping("update")
    public Object update() {
        return restTemplate.getForObject("http://192.168.0.13:6003/ors/order/update", String.class);
    }
}